package com.oocl.reservedparkingsystembackend.service.impl;

import com.oocl.reservedparkingsystembackend.model.entity.ParkingSpace;
import com.oocl.reservedparkingsystembackend.repository.ParkingSpaceRepository;
import com.oocl.reservedparkingsystembackend.service.ParkingSpaceService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ParkingSpaceServiceImpl implements ParkingSpaceService {
    private ParkingSpaceRepository parkingSpaceRepository;

    public ParkingSpaceServiceImpl(ParkingSpaceRepository parkingSpaceRepository) {
        this.parkingSpaceRepository = parkingSpaceRepository;
    }

    @Override
    public List<ParkingSpace> getParkingSpaceByParkingLotId(String id) {
        return parkingSpaceRepository.getAllByParkingLotId(id);
    }

    @Override
    public ParkingSpace add(ParkingSpace parkingSpace) {

        ParkingSpace parkingSpace2 = new ParkingSpace("8a80cb8173d8b6bd0173d8b736060000", true);
        ParkingSpace parkingSpace1 = new ParkingSpace("8a80cb8173d8b6bd0173d8b736060000", true);
        parkingSpaceRepository.save(parkingSpace1);

        return parkingSpaceRepository.save(parkingSpace2);
    }
}
